//
//  ViewController.m
//  3.11.1datepicker
//
//  Created by h92 on 14/12/22.
//  Copyright (c) 2014年 李腾飞. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController
@synthesize label;
@synthesize datePicker;

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)pressTime:(id)sender {
    NSDate *myDate=self.datePicker.date;
 
    // 输出现在时间
    NSLog(@"the picker date is %@",[myDate descriptionWithLocale:[NSLocale currentLocale]]);
    
    NSDateFormatter *dataFormatter=[[NSDateFormatter alloc] init];
    
    // 设置时间输出格式
    [dataFormatter setDateFormat:@"YYYY-MM-dd HH:mm:ss"];
    NSLog(@"the date fomate is %@",[dataFormatter stringFromDate:myDate]);
    self.label.text=[dataFormatter stringFromDate:myDate];
    
}
@end
